package com.example.hotelsystem.config.alipay;

import java.io.FileWriter;
import java.io.IOException;


public class AlipayConfig {

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "2016102500758506";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCywRevDyQ/FBYqxW6Bzvefi3wx4DBBNbmsVPg4zG6GXv2Wj13CpvqDK5TT6v20SmH/tq40IlIg5pr2C5nifc0sd8v9UHuCvGfz2X9xffJXs32GlPqBd49m6gY4bQqEw6OuZzYYQvXqU7NNxuW2bFuUkoHUUkoI2786o+kJxq9Zop2vnbxuP/a1ajp2J0RE0UyRcC4QAhHpr+U/trSzHmBB1hUAdvvM1LPwIeO8YUW2UVMGvXuBQs7ToXPx/KnS5aC9Ql60AGuvyvwQZtn9VVJV9v9vk2KD7kHntyIyilyk/KNdFo0A4NSvxQ73N90MBt5JYouamETU+BhWmZ1NS6VpAgMBAAECggEAWrTxN7wPQJMIzJtzABvuO9+kHgsNcYm5tmFHtErIqxb4x7XodiYVaQpscz0DkMFOCVzB+WKRGnDqoYAxjmUYAECqGtkEU8sXVP5BVW3709UZFXnzxE7PTgHjNi7e74/3N0DYimcwMsBWdFlBp9hEgJf3ma5IM0aPO0qBrpxLzseEepbvkQT2cPsBlecPadg2Yozo8id9Gx5iZesPwZ8qrJLLfE81/lmjKszP2TPNPABMSlGW9meq0Z7RNjk7YiabLTedH1LlDZFsC+lgiljByfZ3AOHNHQ0uv/utOiJND2UoC3w9gahtpSQGgy594Lt2nQ+NzcoekQLzkFfm/Bi8AQKBgQDka7A97OSCI9SOqOlKy7X4Nd/O1q5UOC4GqSoUlDqKYyGgLyd/JCR0wx16SKqXkvm3l+YfeEafL8NVz/dUFuNwDgI75RYVl8NeTHeqUV1T1kxs5Rdu0pTMudT24667eO94rmXU29hhVhk3uTFatMo11CBBibjGjBUsmaImpIdiEQKBgQDIVkDMl70Rf2gUfFE1gmidQCJbqMnsmXaOrpYQyAE9LV2fv25Cum1bKXISFMlKUFETvupRMlFYhW7gkqMZDJrvr2nux2byQ7Qot4OwmP3AR3BuRg82Rc7d9Bmdf+GrwFNv5YcU55bV5s5sGB0KUlyQIPdSJ1nytr0S4SaUX3w12QKBgQDOVl0JQ3IUAUvkZr7++s/xXLFExfcKSwmAqNVDa7cKBYx9h7sVBdAMzahWK0g2zeTYLNYK/XpGGD5KyScxhc+EDJOGCWYOsV4hU9ARQZidwAqfn76wNHeIDCJNt9TCsvcXu+pvAv0OyFjVVmw39PJo96r/qOoKKMaD2HB6mctWEQKBgGPueoZTzpES36UQWiX59hsyqbDVIlxuNLB5sAuQ6OVOYtxTzjlk6zXFF8yjJ8F1DOxvmEyGcANbE/Lb0pWlLwgOlSXxu41vbke9Ouh1eGZYfGHVerMU4Vrf74McDkLxPe2cLeSknR338tICuUGz0c5nU1dcn8atluT7AJaUhs4JAoGAcfGwR2UlS6gdVG7bwg+fahN291Bz2u1ZTIzIpCjBwb15gw0ZP9t6i3vKxnKETVK9HIpZIT0YJeEEYA5EdHZe3YySBtL9uxgR6qyBPg0h/dS2Pdh+HkIvXIzcZIrtsc+SsJzZW7e5riiqfuB3s/xOlIc0UVVE4ZQUcJn08OJ0DD4=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqkYBru9DoyWP6oExr2QBojJO5tIdQfeOYfo+JB3wimzq7DASeobM9Kvf8Os+ye/A2FjzjBeLcctMVALnRM+72TxoqqbieFqnNyhp7UxeU/2bApHGkfwUKARHEbIRVVzmWxZesYMQTXMzzxKx0wWTbxng+e5KskUjXbqDvL5u4482bGMKIdXMD5zeyxS+s0M2E1bQcmYfRpPS7IpiCjgnaKhI4jpE1TRkmF7XSq4o8kiGSnkYTX+up4VEs/ozjUTmZOHJJJcz8J61rNQrr9960tR+IYPGUwfP7SypCQfl+IFVn/EEJcPhf7rZI6XLyvaKd0MuHVZsD3VniYzrSizkOwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://8.135.35.123:9000/hotelsystem/order/return_url";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
    public static String return_url = "http://8.135.35.123:9000/hotelsystem/order/return_url";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String CHARSET = "utf-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
